﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using webapi.Helper;

namespace webapi.Controllers
{
    [ApiController]
    [Route("[controller]")]
    //[Authorize]
    public class SampleController : ControllerBase
    {

        private readonly ILogger<SampleController> _logger;

        private DbContextHelper _dbContextHelper;

        public SampleController(ILogger<SampleController> logger, DbContextHelper dbContextHelper)
        {
            _logger = logger;
            _dbContextHelper = dbContextHelper;
        }


        [HttpPost("GetSampleData")]
        public String GetSampleData()
        {
            //_dbContextHelper.Users.ToList()
            string userJson = JsonConvert.SerializeObject(_dbContextHelper.Users.ToList());
            return userJson;
        }
    }
}
